def s(r):
    x = []
    a = ["(", "[", "{", "<"]
    b = [")", "]", "}", ">"]
    c = {")": "(", "]": "[", "}": "{", ">": "<"}
    for b in r:
        if b in a:
            x.append(b)
        elif b in b:
            if not x:
                return "False"
            if x[-1] == c[b]:
                x.pop()
            else:
                return "False"
    if not x:
        return "True"
    else:
        return "False"
r = input("Введите порядок скобок")
d = s(r)
print(d)
